#include<stdio.h>

int main()
{
    int n;
    scanf("%d", &n);
    int a[10000];
    int i = 0;
    while(n)
    {
        a[i] = n;
        if(n == 1) break;
        else i ++;

        if(n%2==0) n /= 2;
        else n = n * 3 + 1;
    }
    for(int j = i; j >= 0; j --)
        printf("%d ", a[j]);
    return 0;
}
/*

*/